package com.aiyige.page.player.dialog;

import android.support.v4.content.ContextCompat;

import com.aiyige.R;
import com.aiyige.page.player.PlayerInfo;
import com.chad.library.adapter.base.BaseMultiItemQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import java.util.LinkedList;

/**
 * Created by zhuyakun on 2017/10/26.
 */

public class PlayListAdapter extends BaseMultiItemQuickAdapter<PlayerInfo, BaseViewHolder> {

    private PlayerInfo playSpeed;

    public void setCurrentPlayInfo(PlayerInfo playSpeed) {
        this.playSpeed = playSpeed;
    }

    public PlayListAdapter() {
        super(new LinkedList<PlayerInfo>());
        addItemType(0, R.layout.item_play_speed);
    }

    @Override
    protected void convert(BaseViewHolder helper, PlayerInfo item) {
        boolean selected = playSpeed != null && playSpeed == item;
        helper.setTextColor(R.id.tv_play_speed, ContextCompat.getColor(mContext, selected?R.color.zwcolor_pink_f93684 :R.color.white));
        helper.setText(R.id.tv_play_speed, item.getTitle());
//        if (helper.getAdapterPosition() == (getData().size()-1)) {
//            helper.setVisible(R.id.bottom_line,false);
//        }
//        switch (item.getItemType()) {
//            case RegionItem.TYPE_DATA:
//                helper.setText(R.id.itemTv, item.getName());
//                break;
//            case RegionItem.TYPE_INDEX:
//                helper.setText(R.id.itemTv, item.getIndex());
//                break;
//            default:
//                break;
//        }
    }




}
